{% extends 'html模板/案件-base.html' %}
{% load staticfiles %}
{% block css %}
    <link rel="stylesheet" href="/static/css/my.css">
    <link rel="stylesheet" href="/static/bootstrap-fileinput-master/css/fileinput.min.css">
    <script src="/static/bootstrap-fileinput-master/js/fileinput.js"></script>
    <script src="/static/bootstrap-fileinput-master/js/locales/zh.js"></script>
    <link rel="stylesheet" href="/static/sweetalert/sweetalert.css">
    <script src="/static/sweetalert/sweetalert.js"></script>
    <style>
        #id_aj_wfss {
            resize: none;
            text-indent: 2em;
        }

        .file-drop-zone-title {
            padding: 30px 10px;
        }

        h5 {
            margin-left: 40px;
        }
    </style>
{% endblock %}

{% block mianbaoxiedaohang %}
    补充结案信息
{% endblock %}

{% block main %}
    <form action="" method="post" style="border: #b4b4b4 1px solid;margin: 10px auto;padding-bottom: 10px">
        <input type="text" hidden name="aj_user" id="user" style="display: none;" value="{{ obj.aj_user.value }}">
        {% csrf_token %}
        <h5>立案信息</h5>
        <div class="panel-collapse collapse in" id="jaxx">
            <div class="panel-body">
                <div class="form-group span4 {% if obj.aj_xingzhi.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_xingzhi">{{ obj.aj_xingzhi.label }}</label>
                    {{ obj.aj_xingzhi }}
                    <span class="help-block">{{ obj.aj_xingzhi.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_zhonglei.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_zhonglei">{{ obj.aj_zhonglei.label }}</label>
                    {{ obj.aj_zhonglei }}
                    <span class="help-block">{{ obj.aj_zhonglei.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_sheanjine.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_sheanjine">{{ obj.aj_sheanjine.label }}</label>
                    {{ obj.aj_sheanjine }}
                    <span class="help-block">{{ obj.aj_sheanjine.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_laiyuan.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_laiyuan">{{ obj.aj_laiyuan.label }}</label>
                    {{ obj.aj_laiyuan }}
                    <span class="help-block">{{ obj.aj_laiyuan.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_time1.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_time1">{{ obj.aj_time1.label }}</label>
                    <input type="date" name="aj_time1" value="{{ obj.aj_time1.value|date:"Y-m-d" }}" required=""
                           id="id_aj_time1" class="span4">
                    <span class="help-block">{{ obj.aj_time1.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_dangshiren.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_dangshiren">{{ obj.aj_dangshiren.label }}</label>
                    {{ obj.aj_dangshiren }}
                    <span class="help-block">{{ obj.aj_dangshiren.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_faren.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_faren">{{ obj.aj_faren.label }}</label>
                    {{ obj.aj_faren }}
                    <span class="help-block">{{ obj.aj_faren.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_jigoudaima.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_jigoudaima">{{ obj.aj_jigoudaima.label }}</label>
                    {{ obj.aj_jigoudaima }}
                    <span class="help-block">{{ obj.aj_jigoudaima.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_anyou.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_anyou">{{ obj.aj_anyou.label }}</label>
                    {{ obj.aj_anyou }}
                    <span class="help-block">{{ obj.aj_anyou.errors.0 }}</span>
                </div>
            </div>
        </div>
        <hr>
        <h5>结案信息</h5>
        <div class="panel-collapse collapse in">
            <div class="panel-body">
                <div class="form-group span4 {% if obj.aj_zhuangtai.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_zhuangtai">{{ obj.aj_zhuangtai.label }}</label>
                    {{ obj.aj_zhuangtai }}
                    <span class="help-block">{{ obj.aj_zhuangtai.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_chufajine.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_chufajine">{{ obj.aj_chufajine.label }}</label>
                    {{ obj.aj_chufajine }}
                    <span class="help-block">{{ obj.aj_chufajine.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_heiwodian.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_heiwodian">{{ obj.aj_heiwodian.label }}</label>
                    {{ obj.aj_heiwodian }}
                    <span class="help-block">{{ obj.aj_heiwodian.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_time2.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_time2">{{ obj.aj_time2.label }}</label>
                    <input type="date" name="aj_time2" value="{{ obj.aj_time2.value|date:"Y-m-d" }}" required=""
                           id="id_aj_time2" class="span4">
                    <span class="help-block">{{ obj.aj_time2.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_juedingshu.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_juedingshu">{{ obj.aj_juedingshu.label }}</label>
                    {{ obj.aj_juedingshu }}
                    <span class="help-block">{{ obj.aj_juedingshu.errors.0 }}</span>
                </div>
                <div class="form-group span4 {% if obj.aj_chufayiju.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_chufayiju">{{ obj.aj_chufayiju.label }}</label>
                    {{ obj.aj_chufayiju }}
                    <span class="help-block">{{ obj.aj_chufayiju.errors.0 }}</span>
                </div>
                <div class="form-group span11 {% if obj.aj_wfss.errors.0 %}has-error{% endif %}">
                    <label for="id_aj_wfss">{{ obj.aj_wfss.label }}</label>
                    {{ obj.aj_wfss }}
                    <span class="help-block">{{ obj.aj_wfss.errors.0 }}</span>
                </div>
                <div class="span12" style="text-align: center">
                    <input type="reset" class="btn btn-warning" value="重置">
                    <input type="submit" class="btn btn-success" value="提交">
                </div>
            </div>
        </div>
    </form>
    <div class="span11" style="padding-bottom: 30px">
        <label class="control-label" for="fileinput">上传行政处罚决定书（案件移交函）</label>
        <input type="file" id="fileinput" name="pic" multiple/>
        {% for pic in pic_list %}
            <div class="span11" style="margin-top: 15px">
                <img src="/media/{{ pic.pic }}" alt="" width=100%>
                <button pic_name="{{ pic.pic }}" pic_id="{{ pic.id }}" class="btn btn-danger pull-right del"
                        style="margin-top: 8px">删除
                </button>
            </div>
        {% endfor %}
    </div>
{% endblock %}

{% block js %}
    <script>
        $('#jaxx input,#jaxx select').prop('disabled', 'true')
        $('.form-group input,select').addClass('span4')
        $('#id_aj_wfss').addClass('span11')
        $("#id_aj_time1,#id_aj_time2").prop("type", "date")
        $('#id_aj_zhuangtai option:eq(0)').remove()
        //消除错误提示
        $(":input").click(function () {
            $(this).next().text("");
            $(this).parents('div').removeClass("has-error")
        })

        $('#fileinput').fileinput({
            language: 'zh',
            uploadUrl: '/upload_jaws/{{ id }}/',
            showCaption: true,
            showUpload: true,
            showRemove: true,
            showClose: true,
            layoutTemplates: {
                //actionDelete: ''
            },
            browseClass: 'btn btn-primary',
            maxFileCount: 8,
            autoReplace: true,
            allowedFileTypes: ['image'],
            minImageWidth: 800,
            minImageHeight: 600,
            maxFileSize: 5120,

        });
        $("#fileinput").on("fileuploaded", function (event, data, previewId, index) {
            if (data.response.msg == 100) {
                location.reload()
            }
        });

        if ("{{ msg }}") {
            swal({
                title: "您无权做此操作！",
                text: "{{ msg }}",
                type: "warning",
                showCancelButton: false,
                confirmButtonClass: "btn-danger",
                confirmButtonText: "确定!",
                closeOnConfirm: false,
            })
        }
    </script>
    <script>
    $('.glyphicon-folder-open').addClass('icon-folder-open')
    $('.glyphicon-trash').addClass(' icon-undo')
    </script>
{% endblock %}